<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
function get_td_array($table) {
	    $table = preg_replace("/<table[^>]*?>/is","",$table);
	    $table = preg_replace("/<tr[^>]*?>/si","",$table);
	    $table = preg_replace("/<td[^>]*?>/si","",$table);
	    $table = str_replace("</tr>","{tr}",$table);
	    $table = str_replace("</td>","{td}",$table);
	    $table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table);
	    $table = preg_replace("'([rn])[s]+'","",$table);
	    $table = str_replace(" ","",$table);
	    $table = str_replace(" ","",$table);
	    $table = str_replace("&nbsp;","",$table);

	    $table = explode('{tr}', $table);

	    array_pop($table);
	    foreach ($table as $key=>$tr) {
	        $td = explode('{td}', $tr);
	        $td = explode('{td}', $tr);

	        array_pop($td);
	        $td_array[] = $td;
	    }
	    if(!empty($td_array))
	    {
	    	array_shift($td_array);
	    	return $td_array;
	    }else{
	    	return 1;
	    }
	}